FROM python:3.8.9

RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list

WORKDIR /app

RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    software-properties-common \
    git \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt requirements.txt

RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

COPY . .

ENV PYTHONUNBUFFERED=1

# HEALTHCHECK --interval=5m --timeout=60s \
#     CMD curl --fail http://localhost:7860/_stcore/health || exit 1

EXPOSE 7860

ENTRYPOINT ["streamlit", "run", "app.py", \
            "--server.port=7860",\
            "--server.enableCORS=false", \
            "--server.headless=true", \
            "--server.enableXsrfProtection=false", \
            "--server.fileWatcherType=none", \
            "--global.developmentMode=false", \
            "--server.enableWebsocketCompression=false", \
            "--browser.gatherUsageStats=false"]